<template>
    <div class="app_data">
        <div class="title">
            <h2>数据爬取日志</h2>

        </div>
        <div class="update">
            <Table border :columns="columns1" :data="data1"></Table>
            <div class="page">
                <Page :total=pageInfo.total @on-change="ChangePage" show-total/>
            </div>
        </div>

    </div>
</template>
<script>
import {getLog} from "../api";

export default {
    data() {
        return {
            pageInfo: {
                pageNo: 1,
                pageSize: 10,
                total:0
            },
            columns1: [
                {
                    title: '操作人',
                    key: 'user_name'
                },
                {
                    title: '操作时间',
                    key: 'end_time'
                },
                {
                    title: '爬取数据条数',
                    key: 'data_num'
                },
                {
                    title: '城市',
                    key: 'data_mode'
                }
            ],
            data1: [

            ]
        }
    },
    mounted() {
        this.init()
    },
    methods: {
        async init() {
            const res = await getLog(`pageNo=${this.pageInfo.pageNo}&pageSize=${this.pageInfo.pageSize}`);
            this.pageInfo.total = res.total
            this.pageInfo.pageNo = res.pageno
            this.pageInfo.pageSize = res.pagesize
            this.data1 = res.info
        },
        ChangePage(e) {
            this.pageInfo.pageNo = e
            this.init()
        },
    }
}
</script>
<style>
.app_data {
    width: 100%;
    height: 100%;
    background: #ffffff;
    padding: 0 200px;
    font-family: "Open Sans", sans-serif;
    color: #444;
}

.title {
    margin: 4px auto;
    padding: 30px;
    text-align: center;
}

.title h2 {
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 0;
    color: #5c768d;
}

.title span {
    font-size: 16px;
    color: #444;
    font-family: "Open Sans", sans-serif;
}

.update {
    background: #f5f9fc;
}

.page {
    text-align: center;
    padding: 10px;
}
</style>
